package com.lhhu.demo.service.impl;

import com.lhhu.demo.bean.HandlersMessage;
import com.lhhu.demo.mapper.HandlersMapper;
import com.lhhu.demo.service.HandlersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Auther 虎
 * @Data 2021/3/7 17:59
 * @Version 1.0
 */
@Service
public class HandlersServiceImpl implements HandlersService {
    @Autowired
    private HandlersMapper handlersMapper;

    @Override
    public HandlersMessage getOneHandlersMessage(String username) {
        return handlersMapper.getOneHandlersMessage(username);
    }

    @Override
    public HandlersMessage getOneHandlersMessageByCodes(String codes) {
        return handlersMapper.getOneHandlersMessageByCodes(codes);
    }

    @Override
    public int updateHandlerPassword(String codes, String passwords1, String passwords) {
        String passwords2 = handlersMapper.getPasswordByCodes(codes);
        if(passwords2.equals(passwords1)){

            return handlersMapper.updateHandlerPassword(codes,passwords);
        }else {
            return 4;
        }
    }

    @Override
    public int updateHandlerCodes(String username, String codes) {
        return handlersMapper.updateHandlerCodes(username,codes);
    }
}
